package com.alan.prototype;

/**
 * Created by Alan on 2018/8/23.
 */
public class Prototype implements Cloneable {

    private String name;
    private int age;
    private Person person;

    public Prototype copy() throws CloneNotSupportedException {
        Prototype prototype =  (Prototype) super.clone();
        prototype.setPerson(this.person.clone());
        return prototype;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Person getPerson() {
        return person;
    }

    public void setPerson(Person person) {
        this.person = person;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }
}
